using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace CubicFWNet.Data.Models.Mapping
{
    public class OrderMap : EntityTypeConfiguration<Order>
    {
        public OrderMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Number)
                .HasMaxLength(64);

            this.Property(t => t.CreatorName)
                .HasMaxLength(64);

            this.Property(t => t.Delivery)
                .HasMaxLength(64);

            this.Property(t => t.Channel)
                .HasMaxLength(64);

            this.Property(t => t.Memo)
                .HasMaxLength(256);

            this.Property(t => t.SendTime)
              .HasMaxLength(256);

            this.Property(t => t.CusNumber)
             .HasMaxLength(64);

            // Table & Column Mappings
            this.ToTable("Order");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.CustomeId).HasColumnName("CustomeId");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.Stage).HasColumnName("Stage");
            this.Property(t => t.InitPrice).HasColumnName("InitPrice");
            this.Property(t => t.FinalPrice).HasColumnName("FinalPrice");
            this.Property(t => t.UserId).HasColumnName("UserId");
            this.Property(t => t.CreatorId).HasColumnName("CreatorId");
            this.Property(t => t.CreatorName).HasColumnName("CreatorName");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.Delivery).HasColumnName("Delivery");
            this.Property(t => t.Channel).HasColumnName("Channel");
            this.Property(t => t.Memo).HasColumnName("Memo");
            this.Property(t => t.SendTime).HasColumnName("SendTime");
            this.Property(t => t.SubmitTime).HasColumnName("SubmitTime");
            this.Property(t => t.EndTime).HasColumnName("EndTime");
            this.Property(t => t.CusNumber).HasColumnName("CusNumber");
            this.Property(t => t.IsWork).HasColumnName("IsWork");
        }
    }
}
